﻿using System;
using System.Collections.Generic;
using HelfenHelfen.Logic.Interfaces;
using HelfenHelfen.DataAccess.Entities;
using HelfenHelfen.Logic.Entities;

namespace HelfenHelfen.Logic.Factories
{
    // A generic helper to connect the logoc elements to ASP.NET
    public class DemandLogicAdapter<T> where T : IDemandLogic
    {
        IDemandLogic _instance;

        public DemandLogicAdapter()
        {
            _instance = Activator.CreateInstance<T>();
        }

        public IList<Demand> GetAll()
        {
            return _instance.GetAll();
        }

        public IList<Demand> GetAll(string city, Guid category, DateTime? date)
        {
            return _instance.GetAll(city, category, date);
        }

        public IList<Demand> GetAllHighlights()
        {
            return _instance.GetAllHighlights();
        }

        public DemandDetailView GetDetailView(Guid id)
        {
            return _instance.GetDetailView(id);
        }

        public Demand Get(Guid id)
        {
            return _instance.Get(id);
        }

        public IList<string> GetAllCities()
        {
            return _instance.GetAllCities();
        }
    }
}
